package com.itheima.tlias.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.tlias.dto.OperateLogDTO;
import com.itheima.tlias.mapper.OperateLogMapper;
import com.itheima.tlias.po.OperateLogPageParam;
import com.itheima.tlias.service.OperateLogService;
import com.itheima.tlias.util.ResultUtil;
import com.itheima.tlias.vo.PageVO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OperateLogServiceImpl implements OperateLogService {

    @Resource
    OperateLogMapper logMapper;

    @Override
    public ResultUtil selectAllLog(OperateLogPageParam param) {
        Page<Object> page = PageHelper.startPage(param.getPage(), param.getPageSize());
        List<OperateLogDTO> dtos = logMapper.selectAllLog(param);
        PageVO<OperateLogDTO> pageVO = new PageVO<>();
        pageVO.setTotal(page.getTotal());
        pageVO.setRows(dtos);
        return ResultUtil.success(pageVO);
    }
}
